package com.ex.mzwqz.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.ex.mzwqz.fragment.NewsFragment;

import java.util.List;

/**
 * Created by xiaguoqiang on 16/10/19.
 */
public class NewsTabAdapter extends FragmentPagerAdapter{

    private List<NewsFragment> fragments;

    public NewsTabAdapter(FragmentManager fm,List<NewsFragment> fragments) {
        super(fm);
        this.fragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return fragments.get(position).getTitle();
    }
}
